package com.chainyoung.component_tmperson.ui.mvp.presenter;

import com.chainyoung.common.appcommon.entity.RecieveAccount;
import com.chainyoung.common.base.CommonSubscriber;
import com.chainyoung.common.di.scope.ActivityScope;
import com.chainyoung.common.mvp.BasePresenter;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmperson.ui.mvp.contract.AccountInfoContract;
import com.chainyoung.component_tmperson.ui.mvp.contract.RecieveAccountListContract;

import java.util.List;
import java.util.TreeMap;

import javax.inject.Inject;

@ActivityScope
public class AccountInfoPresenter extends BasePresenter<AccountInfoContract.Model, AccountInfoContract.View> {

    @Inject
    public AccountInfoPresenter(AccountInfoContract.Model model, AccountInfoContract.View rootView) {
        super(model, rootView);
    }


    public void getRecieveAccountInfo(TreeMap<String, Object> map) {
        addSubscribe(mModel.getAccountInfo(map)
                .compose(RxUtils.<RecieveAccount>rxSchedulerHelper())
                .subscribeWith(new CommonSubscriber<RecieveAccount>(mView) {
                    @Override
                    public void onNext(RecieveAccount data) {
                        mView.onGetAccountInfo(data);
                    }

                    @Override
                    public void onError(Throwable e) {
                        super.onError(e);
                    }
                }));
    }


}
